package com.gd.controller;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.gd.model.Product;
import com.gd.service.ProductListService;

@Controller
public class ProductListController {
	private static Log log = LogFactory.getLog(ProductListController.class);
	
	@Autowired
	private ProductListService productListService;
	
	
	@RequestMapping("/products")
	public String getAssetList(Model model) {
		List<Product> products = productListService.getProducts();
		log.info("product count: " + products.size());
		model.addAttribute("products", products);
		return "productList";
	}
}
